#include <iostream>
#include <boost/scoped_ptr.hpp>
#include <boost/lexical_cast.hpp>   

//g++ -o boost_test boost_test.cpp 
/* $ ldd boost_test
   linux-gate.so.1 =>  (0xb7ef4000)
   libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb7de4000)
   libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7dbf000)
   libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7db3000)
   libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb7c64000)
   /lib/ld-linux.so.2 (0xb7ef5000)
 */

int main (int argc, char **argv)
{
	int pcr = 100;
	boost::scoped_ptr < int >m_lastPCR;
	m_lastPCR.reset (new int (pcr));
	std::cout << "boost: " << *m_lastPCR << std::endl;

	int a = boost::lexical_cast<int>("123");   
	double b = boost::lexical_cast<double>("123.12");   
	std::cout<<a<<std::endl; 
	std::cout<<b<<std::endl;   

	int i;
	try  
	{   
		i = boost::lexical_cast<int>("xyz");   
	}   
	catch(boost::bad_lexical_cast& e)   
	{   
		std::cout<<e.what()<<std::endl;   
		return 1;   
	}   

	return 0;
}
